<?php
namespace catchAdmin\settlement\model\search;

trait ExpensesSearch
{
    public  function searchExpensesTypeAttr($query, $value, $data)
    {
        return $query->where('expenses_type',$value);
    }
    public  function searchExpenseCodeAttr($query, $value, $data)
    {
        return $query->whereLike('expense_code',$value);
    }
    public  function searchSettlementCodeAttr($query, $value, $data)
    {
        return $query->whereLike('settlement_code',$value);
    }
    public  function searchAccountNumberAttr($query, $value, $data)
    {
        return $query->whereLike('account_number',$value);
    }
    public  function searchInvoiceNoAttr($query, $value, $data)
    {
        return $query->whereLike('invoice_no',$value);
    }
    public  function searchJobNumberAttr($query, $value, $data)
    {
        return $query->whereLike('job_number',$value);
    }
    public  function searchMoneyStartAttr($query, $value, $data)
    {
        return $query->where('money','>=',$value);
    }
    public  function searchMoneyEndAttr($query, $value, $data)
    {
        return $query->where('money','<=',$value);
    }
    public  function searchCurrencyAttr($query, $value, $data)
    {
        return $query->where('currency',$value);
    }
    public  function searchInvoicingDateAttr($query, $value, $data)
    {
        return $query->where('invoicing_date','between',[$value[0],$value[1]]);
    }
}